package com.kf.bigbluebook.common;

import com.kf.bigbluebook.exception.BusinessException;

public class ResultUntils {
    //成功
    public static <T> BaseResponse<T> success(T data) {
        return new BaseResponse<>(0, data, "ok", "success");
    }
    //失败
    public static BaseResponse err(ErrorCode errorCode) {
        return new BaseResponse<>(errorCode);
    }
    public static BaseResponse err(BusinessException e) {
        return new BaseResponse<>(e);
    }


    public static BaseResponse err(ErrorCode errorCode, String description) {
        return new BaseResponse<>(errorCode.getCode(),null,errorCode.getMessage(), description);
    }
}
